<?php
namespace app\admin\model;
use think\Model;

class Message extends Model{
	public function list(){
		$mes = new Message();
		$list = self::all();
		
		return $list;
	}
	public function add(){
		
		$data=[
				'n_id'=>input("param.n_id"),
		       'rom_id'=>input("param.r_id"),
		       't_id'=>input("param.t_id"),
		       'area'=>input("param.area"),
		  	'tel'=>input("param.tel"),
		   	'yajin'=>input("param.yajin"),
		   'parment_method'=>input("param.p_id"),
		   'zujin'=>input("param.zujin"),
		   'guanliyuan'=>input("param.guanliyuan")
			];
		$mes = new Message();
		
		$result = $mes->save($data);
		return $result;
	}
	public function upd(){
		
		$mes = new Message();
		$result = $mes->save([
		  'n_id'=>input("param.n_id"),
		  'rom_id'=>input("param.r_id"),
		  't_id'=>input("param.t_id"),
		  'area'=>input("param.area"),
		  'tel'=>input("param.tel"),
		   'yajin'=>input("param.yajin"),
		   'parment_method'=>input("param.p_id"),
		   'zujin'=>input("param.zujin"),
		   'guanliyuan'=>input("param.guanliyuan")
		   
		],['id'=>input('param.id')]);
		
		return $result;
	}
	public function number()
    {
        return $this->hasOne('number','n_id','n_id');
    }
    public function type()
    {
        return $this->hasOne('type','t_id','t_id');
    }
    public function pay()
    {
        return $this->hasOne('pay','p_id','parment_method');
    }
    public function rom()
    {
        return $this->hasOne('rom','r_id','rom_id');
    }
}
?>